<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  
</body>
<script>

  // 类与类的继承


  function Parent2(m){
    this.abc = "abc";
    this.msg = "msg";
  }
  function Parent(m){
    this.msg = m;
    this.show = function(){
      console.log(this.msg)
    }
  }
  // Parent.prototype.init = function(){
  //   console.log("init")
  // }


  function Child(m){
    // 在当前位置，修改Parent的this为当前Child的this
    Parent.call(this, m);
    Parent2.call(this);
  }

  const p = new Parent("hello");
  console.log(p);
  console.log(p.msg);
  p.show();
  // p.init();

  const c = new Child("world");
  console.log(c)
  console.log(c.msg)
  console.log(c.abc)
  c.show();
  // c.init();

  
</script>
</html>